package com.sgb.kjwl.view.ui.adapter;

import android.os.Parcelable;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import com.sgb.kjwl.model.entity.ParentAreaEntity;
import com.swgk.core.util.PickSelectEntity;

import java.util.ArrayList;
import java.util.List;

public class CommPagerAdapter6 extends FragmentStatePagerAdapter {

    private ArrayList<? extends Fragment> items;
    private List<ParentAreaEntity<List<ParentAreaEntity<List<ParentAreaEntity>>>>> channelEntityList = new ArrayList<>();
    private FragmentManager fm;

    public CommPagerAdapter6(FragmentManager fm, ArrayList<? extends Fragment> items, List<ParentAreaEntity<List<ParentAreaEntity<List<ParentAreaEntity>>>>> channelEntityList) {
        super(fm);
        this.items = items;
        this.fm = fm;
        if (channelEntityList != null){
            this.channelEntityList.clear();
            this.channelEntityList.addAll(channelEntityList);
        }
    }

    @Override
    public int getCount() {
        return items.size() == 0 ? 0 : items.size();
    }

    @Override
    public Fragment getItem(int position) {
        return items.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        if (position < channelEntityList.size()) {
            return channelEntityList.get(position).getName();
        }
        return "";
    }

}
